import markdown
from weasyprint import HTML

# 读取Markdown文件
with open('readme.md', 'r', encoding='utf-8') as f:
    md_content = f.read()

# 将Markdown转换为HTML
html_content = markdown.markdown(md_content)

# 将HTML内容转换为PDF文件
HTML(string=html_content).write_pdf('output.pdf')